//package study.springboot.async.support.web;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//import org.springframework.web.context.request.async.TimeoutCallableProcessingInterceptor;
//import org.springframework.web.context.request.async.TimeoutDeferredResultProcessingInterceptor;
//import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//import javax.annotation.PostConstruct;
//
//@Slf4j
//@Configuration
//public class WebMvcCfg implements WebMvcConfigurer {
////
////    @Autowired
////    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
////
////    @PostConstruct
////    public void init() {
////        threadPoolTaskExecutor.setThreadNamePrefix("async-test-");
////        threadPoolTaskExecutor.setMaxPoolSize(10);
////    }
//
//    /**
//     * 异步配置
//     */
//    @Override
//    public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
//        //默认超时时间
//        configurer.setDefaultTimeout(60 * 1000);
//        //任务执行器
////        configurer.setTaskExecutor(threadPoolTaskExecutor);
//        //Callable拦截器
//        configurer.registerCallableInterceptors(timeoutCallableProcessingInterceptor());
//        //DeferredResult拦截器
//        configurer.registerDeferredResultInterceptors(timeoutDeferredResultProcessingInterceptor());
//    }
//
//    @Bean
//    public TimeoutCallableProcessingInterceptor timeoutCallableProcessingInterceptor() {
//        return new TimeoutCallableProcessingInterceptor();
//    }
//
//    @Bean
//    public TimeoutDeferredResultProcessingInterceptor timeoutDeferredResultProcessingInterceptor() {
//        return new TimeoutDeferredResultProcessingInterceptor();
//    }
//}
